clear
capture log close
set more off
use Couples1960

keep statefip metarea age race hispan educd age_m agemarr marrno_m

gen urban=(metarea==0)
gen white=(race==1&hispan==0)
gen black=(race==2&hispan==0)
gen hisp=(hispan!=0)
gen hs=(educd>=60)
gen coll=(educd>=100)

gen stfips=urban*100+statefip
tab stfips, gen(stu)

gen agediff=age_m-age
gen pos=(agediff>0)
gen agediffpos=agediff*pos
gen agediffneg=agediff*(1-pos)*(-1)
gen ap1=(agediffpos>=2&agediffpos<=4)
gen ap2=(agediffpos>=5&agediffpos<=7)
gen ap3=(agediffpos>=8)
gen an1=(agediffneg>=2&agediffneg<=4)
gen an2=(agediffneg>=5&agediffneg<=7)
gen an3=(agediffneg>=8)

tab age, gen(wfe)

keep if marrno==1
gen agem2=agemarr*agemarr
gen marr2=(marrno_m==2)
gen marr3=(marrno_m>=3)

log using Tab3_women_1960_col1col2.log, replace

quietly logit hs ap1 ap2 ap3 an1 an2 an3 agemarr agem2 marr2 marr3 white black hisp stu* wfe*, robust
mfx, at(mean ap2=0 ap3=0 an1=0 an2=0 an3=0) varlist(ap1)
mfx, at(mean ap1=0 ap3=0 an1=0 an2=0 an3=0) varlist(ap2)
mfx, at(mean ap1=0 ap2=0 an1=0 an2=0 an3=0) varlist(ap3)
mfx, at(mean ap1=0 ap2=0 ap3=0 an2=0 an3=0) varlist(an1)
mfx, at(mean ap1=0 ap2=0 ap3=0 an1=0 an3=0) varlist(an2)
mfx, at(mean ap1=0 ap2=0 ap3=0 an1=0 an2=0) varlist(an3)

quietly logit coll ap1 ap2 ap3 an1 an2 an3 agemarr agem2 marr2 marr3 white black hisp stu* wfe* if hs==1, robust
mfx, at(mean ap2=0 ap3=0 an1=0 an2=0 an3=0) varlist(ap1)
mfx, at(mean ap1=0 ap3=0 an1=0 an2=0 an3=0) varlist(ap2)
mfx, at(mean ap1=0 ap2=0 an1=0 an2=0 an3=0) varlist(ap3)
mfx, at(mean ap1=0 ap2=0 ap3=0 an2=0 an3=0) varlist(an1)
mfx, at(mean ap1=0 ap2=0 ap3=0 an1=0 an3=0) varlist(an2)
mfx, at(mean ap1=0 ap2=0 ap3=0 an1=0 an2=0) varlist(an3)

log close

